import java.util.*;
public class _acw12311 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>();
        int t=sc.nextInt();
        while(t-->0){
            int h=sc.nextInt();
            int m=sc.nextInt();
            int end=h*60+m;
            if(hm.containsKey(end)){
                hm.put(end, (int)hm.get(end)+1);
            }else {
                hm.put(end, 1);
            }
        }
        int max=0;
        for(Integer value: hm.values()) {
            // 输出每一个value
            if(value>max){
                max=value;
            }
          }
        System.out.println(max);
    }
}
